package com.liveinstars.api.facade;

import com.liveinstars.api.dto.*;
import com.liveinstars.api.query.ActivityNewQuery;
import com.liveinstars.api.query.ActivityNewQuery;
import com.onepiece.shipelves.common.Result;
import com.onepiece.shipelves.common.vo.Page;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient("activity")
public interface IActivityApi {

    /**
     * 获取分页圈子列表
     * 默认根据时间再距离
     * 新建活动时将活动的地理位置插入redis，然后排序时通过geo获取1000公里内的按近到远的点，
     * 然后获取调用分页传递ids
     *
     * @param query
     * @return
     */
    @PostMapping("/activity/pageByQuery")
    Result<Page<ActivityDto>> pageByQuery(@RequestBody ActivityNewQuery query);

//    //用户管理员查询全部活动，只使用了query中的type字段
//    @PostMapping("/activity/getAllActivitys")
//    Result<Page<ActivityDto>> getAllActivitys(@RequestBody ActivityNewQuery query);

//    @PostMapping("/activity/getGroupActivitys")
//    Result<Page<ActivityDto>> getGroupActivitys(@RequestBody ActivityNewQuery query);
    /**
     * 查询与我有关的活动,根据我的兴趣和小圈查询招募活动和兴趣活动
     * @param query
     * @return
     */
    @PostMapping("/activity/pageByNewQuery")
    Result<Page<ActivityDto>> pageByNewQuery(@RequestBody ActivityNewQuery query, @RequestHeader("uid") Integer userId);

    /**
     * 获取圈子详情
     *
     * @param id
     * @return
     */
    @GetMapping("/activity/getDetailById")
    Result<ActivityDetailDto> getDetailById(@RequestParam(value = "id") Integer id, @RequestHeader("uid") Integer userId);

    @GetMapping("/activity/viewActivity")
    Result<Boolean> viewActivity(@RequestParam(value = "id") Integer id);

    @GetMapping("/activity/likeActivity")
    Result<Boolean> likeActivity(@RequestParam(value = "id") Integer id, @RequestHeader("uid") Integer userId);

    @GetMapping("/activity/unLikeActivity")
    Result<Boolean> unLikeActivity(@RequestParam(value = "id") Integer id, @RequestHeader("uid") Integer userId);


    @GetMapping("/activity/getActivitys")
    Result<List<ActivityDto>> getActivitys(@RequestParam(value = "user_id") Integer userId);


    @GetMapping("/activity/updateStatus")
    Result<Boolean> updateStatus(@RequestParam("activityId") Integer activityId,
                                 @RequestParam("status") int status);

    @GetMapping("/activity/getApplyActivitys")
    Result<List<ActivityDto>> getApplyActivitys(@RequestParam(value = "user_id") Integer userId);

    //    /**
//     * 创建
//     * @param dto
//     * @return
//     */
    @PostMapping("/activity/create")
    Result<ActivityDetailDto> create(@RequestBody ActivityCreateDto dto);

    //    /**
//     * 根据id更新数据群组信息
//     * @param vo
//     */
    @PostMapping("/activity/updateById")
    Result<ActivityDetailDto> updateById(@RequestBody ActivityCreateDto vo, @RequestParam(value = "activityId") Integer activityId);

    //
//    /**
//     * 删除
//     * @param id
//     * @return
//     */
    @GetMapping("/activity/deleteById")
    Result deleteById(@RequestParam(value = "id") Integer id);


    /**
     * 获取审核问题
     *
     * @param activityId
     * @return
     */
    @GetMapping("/activity/getQuestion")
    Result<List<QuestionDto>> getQuestion(@RequestParam(value = "activityId") Integer activityId);


    /**
     * 活动申请接口需要添加todo
     *
     * @return
     */
    @PostMapping("/activity/joinActivity")
    Result<Boolean> joinActivity(@RequestBody ActivityApprovalDto dto);

    @GetMapping("/activity/getActivityMemeber")
    Result<List<ActivityMemberDto>> getActivityMember(@RequestParam(value = "activityId", defaultValue = "") Integer activityId);


    @GetMapping("/activity/addActivityMember")
    Boolean addActivityMember(@RequestParam(value = "fromId") Integer fromId, @RequestParam(value = "userId") Integer userId, @RequestParam(value = "groupId") Integer groupId);


}
